//
//  main.m
//  NSString简介
//
//  Created by mir_yan on 2018/9/26.
//  Copyright © 2018年 hakeem. All rights reserved.
//

#import <Foundation/Foundation.h>

void showString(NSString* str) {
    NSLog(@"str = %@", str);
}

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        
        // 字符串构建
        NSString* s1 = @"asdf";
//        NSString* str2 = [[NSString alloc] initWithString:@"asdfasfd"];
        NSString* str3 = [NSString stringWithString:s1];
        
//        [s1 stringByAppendingString:@"so hello"];
        NSString* nStr1 = [s1 stringByAppendingString:@"so hello"];
        
        NSLog(@"nStr1 = %@", nStr1);
        
        // 可变字符串
        NSMutableString* mStr1 = [[NSMutableString alloc] init];
        
        // 拼接新的内容
        [mStr1 appendString:@"sdfs"];
        
        NSLog(@"mStr1 = %@", mStr1);
        showString(mStr1);
        
        // 长度
        NSLog(@"mStr1.length = %ld", mStr1.length);
        
        NSLog(@"Hello, World!");
    }
    return 0;
}
